mod devices;

use anyhow::Result;
use clap::Parser;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
    #[arg(short, long)]
    token: String,
}

#[tokio::main]
async fn main() -> Result<()> {
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::DEBUG)
        .init();

    let args = Args::parse();

    let token = args.token;
    ::tracing::debug!("获取参数Token:{}", token);

    devices::start(&token).await?;

    //
    if let Err(e) = ::tokio::signal::ctrl_c().await {
        panic!("Failed to listen for the ctrl-c signal: {:?}", e);
    }
    Ok(())
}
